{extend name='main'}

{block name="button"}
{if auth("add")}
<button data-open='{:url("add",input(""))}'  class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
{/if}
{/block}

{block name="content"}

<div class="think-box-shadow">
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='text-left nowrap'>头像</th>
            <th class='text-left nowrap'>姓名</th>
            <th class='text-left nowrap'>年龄</th>
            <th class='text-left nowrap'>手机号码</th>
            <th class='text-left nowrap'>毕业院校</th>
            <th class='text-left nowrap'>从业时间</th>
            <th class='text-left nowrap'>授课科目</th>
            <th class='text-left nowrap'>授课城市</th>
            <th class='text-left nowrap'>授课区域</th>
            <th class='text-left nowrap'>状态</th>
            <th class='text-left nowrap'>申请时间</th>
            <th class='text-center nowrap'>操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='text-left'>
                <img width="75" src="{$vo.avatar|default=''}" data-tips-image>
            </td>
            <td class='text-left'>
                {$vo.name|default=''}
            </td>
            <td class='text-left'>
                {$vo.age|default=''} 岁
            </td>


            <td class='text-left'>
                {$vo.mobile|default=''}
            </td>
            <td class='text-left'>
                {$vo.school|default=''}
            </td>

            <td class='text-left'>
                {$vo.working_years|default=''} 年
            </td>
            <td class='text-left'>
                {notempty name='vo.cate'}
                {foreach $vo.cate as $k=>$v}
                <span class="layui-badge-rim notselect" style="margin: 5px">{$v.name}</span>
                {/foreach}
                {/notempty}
            </td>
            <td class='text-left'>
                {$vo.city.name|default=''}
            </td>
            <td class='text-left'>
                {notempty name='vo.area'}
                {foreach $vo.area as $k=>$v}
                <span class="layui-badge-rim notselect" style="margin: 5px">{$v.name}</span>
                {/foreach}
                {/notempty}
            </td>
            <td class='text-left' >
                {switch vo.status }
                {case 1 }<span class="color-green">已通过</span>{/case}
                {case 2}<span class="color-red">已拒绝</span>{/case}
                {default /}
                <span class="color-desc">审核中</span>
                {/switch}
            </td>
            <td class="text-left nowrap">
                日期：{$vo.create_at|default=''|str_replace=' ','<br><span class="color-desc">时间：',###|raw}</span>
            </td>
            <td class='text-right operator'>
                {if auth("edit")}
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑" data-open='{:url("edit")}?id={$vo.id}&spm={:input("spm")}'>编 辑</a>
                {/if}

                {if auth("state")}
                {switch vo.status }
                {case 1 }<a class="layui-btn layui-btn-sm layui-btn-disabled">已通过</a>{/case}
                {case 2}<span class="layui-btn layui-btn-sm layui-btn-disabled">已拒绝</span>{/case}
                {default /}
                <a class="layui-btn layui-btn-sm " data-title="通过" data-action='{:url("state")}' data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}">通过</a>
                <a class="layui-btn layui-btn-danger layui-btn-sm" data-confirm="确定要拒绝吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#2" data-csrf="{:systoken('state')}">拒 绝</a>
                {/switch}
                {/if}

                {if auth("remove")}
                <a class="layui-btn layui-btn-danger layui-btn-sm" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
<style>
.operator a{margin-bottom: 5px;}
</style>

<script>
    layui.use(['form','upload'], function(){
        const layer = layui.layer;
        const $ = layui.jquery
            , upload = layui.upload;
    });
</script>

{/block}
